Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contrib/database/sql: Disable DBStats if statsd client initialization fails #2682

Merged
merged 12 commits into from
May 8, 2024

Conversation

mtoffl01
Copy link
Contributor

@mtoffl01 mtoffl01 commented May 2, 2024

What does this PR do?

DBStats is disabled — and no metric submission is attempted from the database/sql contrib — when the contrib fails to create a statsd client. This can happen if, for example, the DogStatsD address granted to the tracer is an inaccessible unix domain socket.

Motivation

The contrib/database/sql was attempting metric submission if the DBStats feature was enabled, even if the statsd client initialization failed. This was causing a nil pointer exception when the nil statsd client was called upon to submit metrics (e.g, statsd.Gauge(...) where statsd is nil)

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild.

Unsure? Have a question? Request a review!

mtoffl01 added 2 commits May 2, 2024 15:08
…ddr, and add tracer test to confirm the globalconfig inerhits the tracer's dogstatsd address even when UDS
@mtoffl01 mtoffl01 requested a review from a team as a code owner May 2, 2024 19:19
@github-actions github-actions bot added the apm:ecosystem contrib/* related feature requests or bugs label May 2, 2024
@pr-commenter
Copy link

pr-commenter bot commented May 2, 2024

Benchmarks

Benchmark execution time: 2024-05-07 19:08:23

Comparing candidate commit 803e2ac in PR branch mtoff/dbstats-invalid-uds with baseline commit 3a426ca in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 44 metrics, 0 unstable metrics.

contrib/database/sql/metrics.go Outdated Show resolved Hide resolved
@mtoffl01 mtoffl01 requested a review from a team as a code owner May 6, 2024 14:41
@mtoffl01 mtoffl01 requested a review from a team as a code owner May 8, 2024 14:05
@darccio darccio merged commit b4d38fc into main May 8, 2024
156 of 158 checks passed
@darccio darccio deleted the mtoff/dbstats-invalid-uds branch May 8, 2024 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apm:ecosystem contrib/* related feature requests or bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants